package com.dada.controller;

import com.dada.domain.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Created by jianweilin on 16/8/25.
 */
@Controller
@RequestMapping("/hello1/api")
public class HelloController3 {
    @ResponseBody
    @RequestMapping(value = "/put3", method = RequestMethod.PUT, consumes = "application/text", produces = "application/text")
    @ApiOperation(value = "推送数据", notes = "将BI数据推送到服务端")
    public String push(@ApiParam(required = true, name = "username", value = "用户名") @RequestParam String username) {
        return "push data to server";
    }

    @ResponseBody
    @RequestMapping(value = "/login3", method = RequestMethod.POST, consumes = "application/json", produces = "application/text")
    @ApiOperation(value = "登录", notes = "用户登录网站")
    public String login(@ApiParam(required = true, name = "user", value = "用户对象") @RequestBody User user) {
        return "login";
    }

    @ResponseBody
    @RequestMapping(value = "/user/list3", method = RequestMethod.GET, produces = "application/text")
    @ApiOperation(value = "获取信息", notes = "获取用户信息")
    public String list(@ApiParam(required = true, name = "username", value = "姓名") @RequestParam String username,
                       @ApiParam(required = true, name = "password", value = "密码") @RequestParam String password,
                       @ApiParam(required = true, name = "address", value = "地址") @RequestParam String address) {
        return username + " : " + password + " : " + address;
    }

}
